﻿using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace 蓝牙注册工具
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : HandyControl.Controls.Window
    {
        /// <summary>
        /// 配置文件model
        /// </summary>
        public static Model.ConfigModel config = new Model.ConfigModel();
        public static View.BluetoothView bluetoothView;
        public static TextBlock textBlockCount = null;
        public static List<string> macs = new List<string>();
        public static BtLabelDAL.MacDAL macDAL = new BtLabelDAL.MacDAL();

        public MainWindow()
        {
            config = BLL.ConfigBLL.GetConfigModel();
            InitializeComponent();
            bluetoothView = BluetoothView1;
            textBlockCount = TextBlockCount;
            textBlockCount.Text = macDAL.GetCount().ToString();
        }

        private void load(object sender, RoutedEventArgs e)
        {
        }


        private void MenuItemBlueTooth_Click(object sender, RoutedEventArgs e)
        {
            DrawerLeft.IsOpen = true;
        }

        private void MenuItemSet_Click(object sender, RoutedEventArgs e)
        {
            DrawerCenter.IsOpen = true;
        }

        private void Window_Closed(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

        private void MenuItemData_Click(object sender, RoutedEventArgs e)
        {
            DrawerCenter.IsOpen = true;
        }

        private void MenuItemConfig_Click(object sender, RoutedEventArgs e)
        {
            DrawerRight.IsOpen = true;
        }


        private void Window_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            //回车键
            if (e.Key == Key.Enter)
            {
                Channel1.Init();
                Channel2.Init();
                Channel3.Init();
                Channel4.Init();
            }
        }
    }
}
